<?php
class ModelRestaurantBooking extends Model {
	public function addBooking($restaurant_id, $data) {
		$sql  = "INSERT INTO " . DB_PREFIX . "booking";
		$sql .= " SET customer_id = '" . (int)$this->customer->getId() . "',";
		$sql .= " restaurant_id = '" . (int)$restaurant_id . "',";
		$sql .= " email = '" . $this->db->escape($data['email']) . "',";
		$sql .= " telephone = '" . $this->db->escape($data['telephone']) . "',";
		$sql .= " number_of_people = '" . (int)$data['num_of_people'] . "',";
		$sql .= " date_booked = STR_TO_DATE('" . $this->db->escape($data['date_booked']) . "','%d/%m/%Y %H:%i'),";
		$sql .= " request_detail = '" . $this->db->escape(strip_tags($data['request_detail'])) . "',";
		$sql .= " booking_status_id = '" . (int)$data['booking_status_id'] . "',";
		$sql .= " ip = '" . $this->db->escape($data['ip']) . "',";
		$sql .= " date_added = NOW()";
		
		$this->db->query($sql);
	}
}
?>